<%
  Public Function GetString(Bytes)
    Dim i
    GetString = ""
    For i = 1 to LenB(Bytes)
        GetString = GetString & Chr(AscB(MidB(Bytes, i, 1)))
    Next
  End Function

  Public Function GetRawString()
    Dim data
    data = Request.BinaryRead(Request.TotalBytes)
    GetRawString = GetString(data)
  End Function

  Public Function CurrentUrl()
    Dim host
    Dim path
    Dim params
    Dim url

    host = Request.ServerVariables("HTTP_HOST")
    path = Request.ServerVariables("PATH_INFO")
    params = Request.ServerVariables("Query_String")

    If params = "" then
      url = host & path
    Else
      url = host & path & "?" & params
    End If
    
    CurrentUrl = url
  End Function

  Public Function Referer()
    Referer = Request.ServerVariables("HTTP_REFERER")
  End Function

  Public Function VisitorIP()
    Dim ip
    ip = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
    If ip = "" Then ip = Request.ServerVariables("REMOTE_ADDR")
    VisitorIP = ip
  End Function
%>
